<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/view/main/stylesheet.jsp"%>
<script src="${baseurl}/styles/frameword/js/jquery.validate.min.js"
	type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css"
	href="${baseurl}/styles/frameword/css/add.css" />
<script src="${baseurl}/styles/frameword/js/validate.js"
	type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	$(function() {
		$("#close-button").click(function() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		});
		var url = "/sys-admin/";
		var rules = {
			name : {
				required : true
			},
			password : {
				required : true
			},
		};
		validate("form1", rules, call)
		function call(param, form) {
			$.post(baseUrl + url + "update", param, function(data) {
				if (data.success) {
					window.location.href = baseUrl + '/result/success';
				} else {
					window.location.href = baseUrl + '/result/failure';
				}
			});
		}
	})
</script>
</head>
<body>
	<form class="bs-example bs-example-form" role="form" id="form1">
		<input type="hidden" name="primaryKey" value="${info.primaryKey}">
		<table class="table noline">
			<tbody>
				<tr>
					<td>
						<div class="input-group">
							<span class="input-group-addon explain">昵称</span> <input
								type="text" name="nickname" value="${info.nickname}"
								class="form-control">
						</div>
					</td>
					<td>
						<div class="input-group">
							<span class="input-group-addon explain">用户名</span> <input
								type="text" name="username" value="${info.username}"
								class="form-control">
						</div>
					</td>
				</tr>
				<tr>
					<td>
						<div class="input-group">
							<span class="input-group-addon explain">登录密码</span> <input
								type="password" name="loginPwd" class="form-control">
						</div>
					</td>
					<td>
						<div class="input-group">
							<span class="input-group-addon explain">用户角色</span> <select
								name="roleId" class="form-control">
								<c:forEach var="item" items="${role}" varStatus="status">
									<c:choose>
										<c:when test="${item.primaryKey==adminrole.primaryKey}">
											<option value="${item.primaryKey}" selected="selected">${item.roleName}</option>
										</c:when>
										<c:otherwise>
											<option value="${item.primaryKey}">${item.roleName}</option>
										</c:otherwise>
									</c:choose>
								</c:forEach>
							</select>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: right;">
						<div class="btn-group">
							<button type="button" class="btn btn-info" id="close-button">
								<i class="glyphicon glyphicon-remove"></i> 取消
							</button>
							<button type="submit" class="btn btn-success">
								<i class="glyphicon glyphicon-ok"></i> 修改
							</button>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</form>

</body>

</html>